﻿Imports System.IO
Namespace control
    Public Class wysDropTextFile


        Private _文件类型 As New List(Of String)
        Public Property 支持文件类型文件类型() As List(Of String)
            Get
                Return _文件类型
            End Get
            Set(ByVal value As List(Of String))
                _文件类型 = value
            End Set
        End Property

        Private Sub wysDropTextFile_DragDrop(ByVal sender As Object, ByVal e As System.Windows.Forms.DragEventArgs) Handles Me.DragDrop
            Try
                Dim al As Array = CType(e.Data.GetData(DataFormats.FileDrop), Array)
                If al IsNot Nothing Then
                    Dim strFile As String = al.GetValue(0).ToString
                    If File.Exists(strFile) Then
                        Me.Text = strFile
                    End If
                End If
            Catch ex As Exception

            End Try
        End Sub

        Private Sub wysDropTextFile_DragEnter(ByVal sender As Object, ByVal e As System.Windows.Forms.DragEventArgs) Handles Me.DragEnter
            If e.Data.GetDataPresent(DataFormats.FileDrop) Then
                e.Effect = DragDropEffects.Copy
            Else
                e.Effect = DragDropEffects.None
            End If

        End Sub

    End Class
End Namespace

